//
//  NRWCenterHeader.m
//  Finance
//
//  Created by 邢毅 on 2018/7/31.
//  Copyright © 2018年 com.anpxd. All rights reserved.
//

#import "NRWCenterHeader.h"

@implementation NRWCenterHeader
{
	CALayer *_lineLayer;
	UILabel *_titleLabel;
}

- (instancetype)initWithFrame:(CGRect)frame
{
	self = [super initWithFrame:frame];
	if (self) {
		
		_lineLayer = [CALayer layer];
		_lineLayer.backgroundColor = mainColor().CGColor;
		_lineLayer.frame = CGRectMake(0, 0, 4, frame.size.height);
		[self.contentView.layer addSublayer:_lineLayer];
		
		_titleLabel = [[UILabel alloc] init];
		_titleLabel.textColor = getColor(@"333333");
		_titleLabel.font = getThemeFont(16);
		[self.contentView addSubview:_titleLabel];
		
		[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
			make.left.equalTo(self.contentView.mas_left).offset(16);
			make.centerY.equalTo(self.contentView.mas_centerY);
		}];
		
	}
	return self;
}

- (void)setHeaderTitle:(NSString *)headerTitle {
	
	_headerTitle = headerTitle;
	
	_titleLabel.text = headerTitle;
}

@end
